import { create } from '../asyncActionCreator';

export const TypeOption = {
	// 留存数
	COUNT: 0,
	// 留存率
	RATE: 1,
};

export const RETAINED_URL = '/api/data/StudentMissionRetained';

export const GET_RETAINED_DATA_REQUEST = 'request retained chart data';
export const GET_RETAINED_DATA_SUCCESS = 'request retained chart data success';
export const GET_RETAINED_DATA_FAILURE = 'request retained chart data failure';

export const getRetainedDataRequest = () => ({
	type: GET_RETAINED_DATA_REQUEST,
	payload: { 
	}
});

export const getRetainedDataSuccess = (data) => ({
	type: GET_RETAINED_DATA_SUCCESS,
	payload: {
		...data
	}
});

export const getRetainedDataFailure = (message) => ({
	type: GET_RETAINED_DATA_FAILURE,
	payload: {
		message
	}
});

export const getRetainedData = (params) => (create(
	RETAINED_URL,
	getRetainedDataRequest,
	getRetainedDataSuccess,
	getRetainedDataFailure,
	params
));